module tiandimigong_p81b {
	function _TRIG_初始化_FUNC(this: void, 当前触发器: Trigger, e:base.EventGameStart) {
		if (true) {
			tiandimigong_p81b.控制台类实例 = Object.assign( new tiandimigong_p81b.控制台类(), {
			});
		}
	}
	export let 初始化 = base.trigger_new(_TRIG_初始化_FUNC, [], false, undefined, true)
	function _TRIG_控制台点击_FUNC(this: void, 当前触发器: Trigger, e:控制台点击) {
		if (true) {
			if ((tiandimigong_p81b.是否处于可点击状态())) {
				log.debug("点击了");
				switch (e.控制台按钮参数) {
					case "ctrl_1": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "功能一：<br>创建一个随机品质的装备", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能一();
						break;
					}
					case "ctrl_2": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "功能二：<br>为物品背包的装备添加一条词缀", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能二();
						break;
					}
					case "ctrl_3": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "功能三：<br>为物品背包的装备添加额外属性", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能三();
						break;
					}
					case "ctrl_4": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "切换物品自定义预览模式", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能四();
						break;
					}
					case "ctrl_5": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "开启或关闭多功能物品面板", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能五();
						break;
					}
					case "ctrl_6": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "将当前背包数据存至云端", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能六();
						break;
					}
					case "ctrl_7": {
						base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "获取云端存储的背包数据", (("TOAST") as unknown as string)));
						tiandimigong_p81b.控制台类实例.测试功能七();
						break;
					}
					default : {
						break;
					}
				}
				tiandimigong_p81b.可点击状态冷却();
			} else {
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "点击的太快了", (("WARNING") as unknown as string)));
				log.debug("点击的太快了");
			}
		}
	}
	export let 控制台点击 = base.trigger_new(_TRIG_控制台点击_FUNC, [], false, undefined, true)
	export class 控制台类{
		测试功能一:()=>void = ():void => {
			let 主控位置: Point | undefined;
			log.debug("测试功能一");
			主控位置 = base.player(1).get_hero().get_scene_point();
			base.create_item_on_point((("$$tiandimigong_p81b.item.剑.root") as unknown as IdPreset<"item_id">), 主控位置.polar_to_ex(base.math.random_int(0, 360), 300));
			base.get_last_created_item().set_quality(base.math.random_int(1, 7));
			base.get_last_created_item().add_attr_need(单位属性["等级"], base.get_last_created_item().get_quality());
			base.get_last_created_item().generate_rand_mod();
			base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "创建物品成功", (("SUCCESS") as unknown as string)));
		}
		测试功能二:()=>void = ():void => {
			let 新变量: IdPreset<"buff_id">;
			let 物品数组: Array<Item> = new Array<Item>();
			let 主控位置: Point | undefined;
			log.debug("测试功能二");
			物品数组 = base.player(1).get_hero().get_inventory_items(1);
			if (((物品数组.length != 0))) {
				if (物品数组 !== undefined) {
					for (let [遍历到的数组索引, 遍历到的数组元素] of base.ArrayIterator(物品数组 as unknown as Array<Item>)) {
						log.debug("根据品质为物品添加词缀");
						if (((遍历到的数组元素.get_all_extra_mod(((true) as unknown as IsEquipped)).length == 0))) {
							if (((遍历到的数组元素.get_quality() >= 4))) {
								遍历到的数组元素.add_extra_mod((("$$tiandimigong_p81b.buff.暴击T5.root") as unknown as IdPreset<"buff_id">), true);
								遍历到的数组元素.generate_rand_mod();
							} else {
								遍历到的数组元素.add_extra_mod((("$$tiandimigong_p81b.buff.攻击T5.root") as unknown as IdPreset<"buff_id">), true);
								遍历到的数组元素.generate_rand_mod();
							}
							base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "已为装备添加词缀", (("SUCCESS") as unknown as string)));
						} else {
							base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "装备已有主词缀", (("WARNING") as unknown as string)));
						}
					}
				} else {
					log.warn("不能遍历：物品数组")
				}
			} else {
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "物品背包无装备", (("WARNING") as unknown as string)));
			}
		}
		测试功能三:()=>void = ():void => {
			let 物品数组: Array<Item> = new Array<Item>();
			let 背包的物品: Item | undefined;
			let 主控位置: Point | undefined;
			log.debug("测试功能三");
			物品数组 = base.player(1).get_hero().get_inventory_items(1);
			if (((物品数组.length == 1))) {
				log.debug("为物品添加额外属性");
				背包的物品 = 物品数组[0];
				背包的物品.add_extra_attr(单位属性["暴击"], base.math.random_int(50, 100), ((false) as unknown as _OBJ__UnitPropertySubTypeEx), true);
			} else {
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "物品背包无装备", (("WARNING") as unknown as string)));
			}
		}
		测试功能五:()=>void = ():void => {
			log.debug("测试功能五");
			base.send_custom_event(new tiandimigong_p81b.显示或关闭多功能物品面板(((base.game) as unknown as base.Game)));
		}
		测试功能四:()=>void = ():void => {
			log.debug("测试功能四");
			base.send_custom_event(new tiandimigong_p81b.切换自定义物品预览状态(((base.game) as unknown as base.Game)));
		}
		测试功能六:()=>void = ():void => {
			let 新变量: Array<Item> = base.player(1).get_hero().all_items();
			log.debug("测试功能六");
			base.bind_items_to_user(新变量, base.player(1), ():void => {
				let 错误信息: string = "字符串";
				// 绑定成功的后续操作
				log.debug("成功绑定", 新变量.length, "件装备");
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "绑定物品成功", (("SUCCESS") as unknown as string)));
			}, (错误码:number, 错误信息:string):void => {
				// 绑定失败的后续操作
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "绑定物品失败，原因是".concat(错误信息), (("WARNING") as unknown as string)));
			});
			base.save_score_item_to_unit(base.player(1).get_hero(), ():void => {
				// 保存成功的后续操作
			}, (错误码:number, 错误信息:string):void => {
				// 保存失败的后续操作
			});
		}
		测试功能七:()=>void = ():void => {
			log.debug("测试功能七");
			base.load_score_item_to_unit(base.player(1).get_hero(), ():void => {
				// 还原成功的后续操作
				log.debug("还原成功");
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "还原物品成功".concat(), (("SUCCESS") as unknown as string)));
			}, (错误码:number, 错误信息:string):void => {
				// 还原失败的后续操作
				base.send_custom_event(new tiandimigong_p81b.服务端_提醒信息(((base.game) as unknown as base.Game), "还原物品失败，原因是".concat(错误信息), (("WARNING") as unknown as string)));
			});
		}
		constructor() {
		}
	}
	export let 控制台类实例: tiandimigong_p81b.控制台类 | undefined;
	export class 切换自定义物品预览状态 extends TriggerEvent{
		constructor(public obj:base.Game) {
			super()
		}
		readonly event_name: string = "切换自定义物品预览状态"
		readonly autoForward: boolean = true
	}
	export class 显示或关闭多功能物品面板 extends TriggerEvent{
		constructor(public obj:base.Game) {
			super()
		}
		readonly event_name: string = "显示或关闭多功能物品面板"
		readonly autoForward: boolean = true
	}
	export class 服务端_提醒信息 extends TriggerEvent{
		constructor(public obj:base.Game, public 提醒信息:string, public 信息类型:string) {
			super()
		}
		readonly event_name: string = "服务端_提醒信息"
		readonly autoForward: boolean = true
	}
	export let 按钮点击标旗: boolean = true;
	export let 是否处于可点击状态:()=>boolean = ():boolean => {
		return tiandimigong_p81b.按钮点击标旗;
	}
	export let 可点击状态冷却:()=>undefined = ():undefined => {
		tiandimigong_p81b.按钮点击标旗 = false;
		base.timer_sleep(2);
		tiandimigong_p81b.按钮点击标旗 = true;
	}
	export type 提醒信息预设值 = string
	function _TRIG_多功能面板按钮点击_FUNC(this: void, 当前触发器: Trigger, e:多功能物品面板按钮点击) {
		if (true) {
			switch (e.功能参数) {
				case "销毁": {
					log.debug("销毁了 ", e.面板绑定的物品.link);
					e.面板绑定的物品.remove();
					break;
				}
				case "重铸": {
					log.debug("重铸了 ", e.面板绑定的物品.link);
					tiandimigong_p81b.重铸当前装备词条(e.面板绑定的物品);
					break;
				}
				case "精炼": {
					log.debug("精炼了 ", e.面板绑定的物品.link);
					break;
				}
				default : {
					break;
				}
			}
		}
	}
	export let 多功能面板按钮点击 = base.trigger_new(_TRIG_多功能面板按钮点击_FUNC, [], false, undefined, true)
	export let 重铸当前装备词条:(传入物品:Item)=>undefined = (传入物品:Item):undefined => {
		let 词缀列表: Array<IdPreset<"buff_id">> = new Array<IdPreset<"buff_id">>();
		词缀列表 = 传入物品.get_all_extra_mod(((true) as unknown as IsEquipped));
		log.debug("有这么多条词缀：", 词缀列表.length);
		if (词缀列表 !== undefined) {
			for (let [遍历到的数组索引, 遍历到的数组元素] of base.ArrayIterator(词缀列表 as unknown as Array<IdPreset<"buff_id">>)) {
				log.debug(遍历到的数组元素);
				传入物品.remove_extra_mod(遍历到的数组元素, true);
				传入物品.add_extra_mod(遍历到的数组元素, true);
				传入物品.generate_rand_mod();
			}
		} else {
			log.warn("不能遍历：词缀列表")
		}
	}
	export let 精炼当前装备:()=>undefined = ():undefined => {
	}
	function _TRIG_提示信息_FUNC(this: void, 当前触发器: Trigger, e:tiandimigong_p81b.服务端_提醒信息) {
		if (true) {
			log.debug("提现信息为", e.提醒信息, "类型为", e.信息类型);
			log.debug("预设值为", (("TOAST") as unknown as string));
		}
	}
	export let 提示信息 = base.trigger_new(_TRIG_提示信息_FUNC, [], false, undefined, true)
	//以下为转发事件
	export class 多功能物品面板按钮点击 extends TriggerEvent{
		constructor(public obj:base.Game, public 面板绑定的物品:Item, public 功能参数:string, public player_slot_id:number) {
			super()
		}
		readonly event_name: string = "多功能物品面板按钮点击"
		readonly autoForward: boolean = false
	}
	export class 控制台点击 extends TriggerEvent{
		constructor(public obj:unknown, public 控制台按钮参数:string, public player_slot_id:number) {
			super()
		}
		readonly event_name: string = "控制台点击"
		readonly autoForward: boolean = false
	}
	export class 自定义事件去服务端拿数据细节 extends TriggerEvent{
		constructor(public obj:base.Game, public 选中物品:Item, public player_slot_id:number) {
			super()
		}
		readonly event_name: string = "自定义事件去服务端拿数据细节"
		readonly autoForward: boolean = false
	}
	//为触发器添加事件
	初始化.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "游戏-开始" })
	控制台点击.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "控制台点击" })
	多功能面板按钮点击.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "多功能物品面板按钮点击" })
	提示信息.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "服务端_提醒信息" })
}
